import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import { resolve } from "path"

//自动导入组件以及样式
const AutoImport = require('unplugin-auto-import/vite');
const Components = require('unplugin-vue-components/vite');
const { ElementPlusResolver } = require('unplugin-vue-components/resolvers');

// https://vitejs.dev/config/
export default defineConfig({
  base: process.env.ELECTRON == "true" ? './' : "./",
  plugins: [
    vue(),

    //自动导入组件
    AutoImport({
      resolvers: [ElementPlusResolver()]
    }),
    Components({
      resolvers: [ElementPlusResolver()]
    })
  ],

  resolve: {
    alias: {
      "@": resolve(__dirname, "src")
    }
  }
})